package com.ljs.springbootinit.bizMq;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;

//
public class MyInitMain {
    public static void main(String[] args) {

        try {
            ConnectionFactory factory = new ConnectionFactory();
            factory.setHost("localhost");
            Connection connection = factory.newConnection();
            Channel channel = connection.createChannel();
            String EXCHANGE_NAME = "code_exchange";
            channel.exchangeDeclare(EXCHANGE_NAME, "direct");
            String QueueName="code_queue";
            channel.queueDeclare(QueueName,true,false,false,null );
            channel.queueBind(QueueName,EXCHANGE_NAME,"my_routingKey");
        }catch (Exception e){

        }
    }
}
